package com.launch.carmanager.common.expection;

import com.launch.carmanager.common.Constants;

import java.io.IOError;
import java.io.IOException;

/**
 * Created by ganquan on 2019/3/28 10:12
 */
public class ApiException extends IOException {
    private int code; // API状态码


    public ApiException(String message, int code) {
        super(message);
        this.code = code;
    }
    public int getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        String msg = super.getMessage();
        switch (code) {
            case Constants.ErrorCode.LOGIN_OUT:
                msg = "重新登录";
                break;
            case Constants.ErrorCode.REQUEST_113001:
                msg = "弹框错误";
                break;
        }
        return msg;
    }


}
